// import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
//引入国际化
import i18n  from './i18n/index' 
// 使用循环注册的方式
import * as directives from "./directives"
//批量注册图标
import 'virtual:svg-icons-register'
// 引入ts文件对应的全局注册的组件的配置
import components from './plugins/global-components';
// 引入插件并安装
import { addGlobalPropertiesPlugin } from './plugins/globalProperties'
import Particles from '@tsparticles/vue3'
import { loadFull } from 'tsparticles'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)
const app=createApp(App);
// 开始遍历注册-自定义指令
Object.keys(directives).forEach(key => {
  app.directive(key, directives[key])
})
app.use(components);
app.use(pinia);
app.use(Particles, {
  init: async (engine) => {
    await loadFull(engine) // you can load the full tsParticles library from "tsparticles" if you need it
    // loadSlim 轻量级的
    // await loadSlim(engine) // or you can load the slim version from "tsparticles-slim" if don't need Shapes or Animations
  }
})

app.use(i18n);
app.use(router);
app.use(addGlobalPropertiesPlugin);
app.mount('#app')

